package com.tz.farmer.util;


import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * @author Administrator
 *
 */
public class BlogCrawlerStarter {

    private static Logger logger = LoggerFactory.getLogger(BlogCrawlerStarter.class);
    //url解码之后
    private static final String URL = "http://search.dangdang.com/?key=性教育绘本&act=input&att=1000006:226&page_index=";
//    private static final String URL = "https://www.maersk.com.cn/instantPrice/quotes";

    public static void main(String[] args) {

        JSONObject jsonObject = new JSONObject();
        List<DangBook> dangBooks = ParseUtils.dingParse(URL);
        if(dangBooks != null && dangBooks.size() >0){
            logger.info("解析完数据，准备入库");
            jsonObject.put("code",1);
            jsonObject.put("result","success");
        }else{
            jsonObject.put("code",0);
            jsonObject.put("result","fail");
        }
        System.out.println(jsonObject);


    }


}